/*
 * @(#)StringColumn.java 2016-7-25 下午1:42:22 smd Copyright 2016 Thuisoft, Inc.
 * All rights reserved. THUNISOFT PROPRIETARY/CONFIDENTIAL. Use is subject to
 * license terms.
 */
package com.happut.cmpt.model.column;

import com.happut.cmpt.model.Column;

/**
 * StringColumn
 * @author wfei
 * @time 2016-7-25下午1:42:22
 */
public class StringColumn extends Column {

    /*
     * (non-Javadoc)
     * 
     * @see com.happut.cmpt.model.Column#toColumnSQL()
     */
    @Override
    public String toColumnSQL(boolean needComma) {
        StringBuffer sql = new StringBuffer();
        sql.append(getName());
        sql.append(" varchar(" + getLength() + ")");
        if(needComma){
            sql.append(",");
        }
        sql.append(" -- "+getNick());
        if (getIsNull()!=null && !getIsNull()) {
            sql.append(" not null");
        }
        return sql.toString();
    }

}
